import time


# 倒计时 非递归写法
# def countdown(sec):
#     for i in range(sec, 0, -1):
#         print(i)
#         time.sleep(1)

# 倒计时 递归写法
def countdown(sec):
    # 递归必须要有终止条件
    if sec <= 0:
        print(f"{sec}秒倒计时结束")
    else:
        print(sec)
        time.sleep(1)
        countdown(sec - 1)


# countdown(5)

# 斐波拉契数列
# 1,1,2,3,5,8,13,21.....
# 输出斐波拉契数列指定位置的数值
def fibonacci(n):
    if n in (1, 2):
        return 1
    else:
        return fibonacci(n-2) + fibonacci(n - 1)

print(fibonacci(6))
